package com.xbongbong.saas.enums.dictionary;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @description 工单出库状态
 * @author xinpeng.jiang
 * @date 2020/11/23 11:11
 * @since V1.0
 * @version V1.0
 */
@Getter
public enum WorkOrderShipStatusEnum {
    // 出库状态
    UNSHIPPED(1, "enum.workOrderShipStatus.name.un_shipped", "unshipped"),
    DELIVERED(2, "enum.workOrderShipStatus.name.delivered", "delivered"),
    SHIPPED(3, "enum.workOrderShipStatus.name.shipped", "shipped"),
    EMPTY(4, "enum.workOrderShipStatus.name.empty", "empty")
    ;

    private final Integer code;
    private final String name;
    private final String attr;

    WorkOrderShipStatusEnum(Integer code, String name, String attr) {
        this.code = code;
        this.name = name;
        this.attr = attr;
    }

    public String getName() {
        // 取空值特殊处理
        if (Objects.equals(this.name, EMPTY.name)) {
            return "";
        }
        return I18nMessageUtil.getMessage(name);
    }
}
